﻿using UniMana.Utils.Controls;
using UniMana.Data;
using UniMana.Utils.Data;
using System.Linq;

namespace UniMana.Win.Personnel
{
    public partial class FrmCatalogueIdle : DevExpress.XtraEditors.XtraForm
    {
        bds m_bds = new bds();
        DBMain m_data = new DBMain();
        public FrmCatalogueIdle()
        {
            InitializeComponent();
            m_bds.DataSource = m_data.m_DCSave.Catalogue_Idles.Where(p=>p.V2==true);
            gctSymbol.DataSource = m_bds;
        }

        private void xucBar1_btnAddNew_Click(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            m_bds.AddNew();
        }

        private void xucBar1_btnCancel_Click(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //m_bds.CancelEdit();
        }

        private void xucBar1_btnSave_Click(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.Validate();
            LoadData.SaveAll(m_bds, m_data.m_DCSave);
        }

        private void xucBar1_btnDelete_Click(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            m_bds.RemoveCurrent();
        }


    }
}